<?php

	include_once("include/config.php");
	include_once("include/auth.lib.php");
	include_once("include/functions.php");

	$sql = "SELECT id, nome
			  FROM palestre";
	$result = runSQL($sql);
	
	header("Content-type: application/xml");
	header('Content-Disposition: attachment; filename="palestreDB.xml"');
	
$data = '<?xml version="1.0" standalone="yes"?>
<DATAPACKET Version="2.0">
	<METADATA>
		<FIELDS>
			<FIELD attrname="Codice" fieldtype="i4"/>
			<FIELD attrname="Nome" fieldtype="string" WIDTH="50"/>
		</FIELDS>
		<PARAMS/>
	</METADATA>
	<ROWDATA>	
';
	
	while ($row = mysql_fetch_assoc($result)) {
	
		$data .= '<ROW Codice="'.$row['id'].'" Nome="'.$row['nome'].'"/>';
		
	}
	$data .= '
	</ROWDATA>
</DATAPACKET>';
	
	echo $data;

?>